package org.wordml.core.experiment.word2003.elements;

import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;

import org.wordml.core.experiment.word2003.MSWordNamespace;


public abstract class OffOnElementAttribute extends AbstractWordMLElement implements
		IOffOnElement {
	private String value = null;
	public OffOnElementAttribute(MSWordNamespace namespace) {
		super(namespace);
	}
	public void setValue(boolean v) {
		value = v?"on":"off";
	}	
	@Override
	public void write(XMLStreamWriter writer) throws WordProcessingException{
		if(value == null || value.length() == 0){
			return;
		}
		try {
			writer.writeAttribute("val", value);
		} catch (XMLStreamException e) {
			throw new WordProcessingException(e);
		}
	}
}
